<?php
declare(strict_types=1);
// APP首页
namespace app\tjy_v1\controller;

class Index
{
    // 应用基本信息
    public function index()
    {
        $query = request()->param(); //请求参数
        $apidb = [
            'name' => "淘甲乙",
            '当前应用' => app('http')->getName(),
            // 'TP版本' => \think\facade\App::version(),
            // 'PHP版本号' => phpversion(),
            '当前时间' => date('Y-m-d H:i:s', time()),
            '当前请求参数' => $query,
            '获取当前请求的时间' => request()->time(),
            '当前的请求类型' => request()->method(),
            '当前请求的资源类型' => request()->type(),
            '获取客户端IP地址' => request()->ip(),
            '检测是否是合法的IP地址' => request()->isValidIP(request()->ip()),
            // '将IP地址转换为二进制字符串' => request()->ip2bin(request()->ip()),
            '检测是否使用手机访问' => request()->isMobile(),
            '获取当前包含协议的域名' => request()->domain(),
            '获取当前根域名' => request()->rootDomain(),
            '获取当前子域名' => request()->subDomain(),
            '获取当前泛域名的值' => request()->panDomain(),
            '获取当前完整URL 包括QUERY_STRING' => request()->url(),
            '获取当前URL 不含QUERY_STRING' => request()->baseUrl(),
            '获取当前执行的文件 SCRIPT_NAME' => request()->baseFile(),
            '获取URL访问根地址' => request()->root(),
            '获取URL访问根目录' => request()->rootUrl(),
            '获取当前请求URL的pathinfo信息 含URL后缀' => request()->pathinfo(),
            '当前URL的访问后缀' => request()->ext(),
            '当前请求的host' => request()->host(),
            '当前是否ssl' => request()->isSsl(),
            '当前是否JSON请求' => request()->isJson(),
            '当前是否Ajax请求' => request()->isAjax(),
            '当前是否Pjax请求' => request()->isPjax(),
            // '设置或者获取当前的Header' => request()->header(),
            // '获取server参数' => request()->server(),
        ];
        return json($apidb);
    }

    // 获取首页模块
    public function layout()
    {
        $apidb = [
            'code' => 200,
            'time' => time(),
            'cache' => cache("我是谁"),
            'msg' => "获取首页模块",
            "db" => [
                "list" => [
                    [
                        "module" => "background",
                        "config" => [
                            "background" => [
                                "top" => 0,
                                "bottom" => 0,
                                "left" => 0,
                                "right" => 0,
                                "width" => 0,
                                "height" => 360,
                                "background" => "#C82519",
                                "background2" => "#D64A4A",
                                "direction" => "to bottom",
                                "borderBottomLeftRadius" => 0,
                                "borderBottomRightRadius" => 0
                            ]
                        ]
                    ],
                    [
                        "type" => "search",
                        "config" => [
                            "outer" => [
                                "width" => 750,
                                "height" => 88,
                                "background" => null
                            ],
                            "container" => [
                                "width" => 690,
                                "height" => 60,
                                "background" => "rgba(255, 255, 255, 1)",
                                "borderRadius" => 60
                            ],
                            "font" => [
                                "text" => "输入关键词搜索",
                                "fontSize" => 24,
                                "background" => "#F30"
                            ]
                        ],
                        "data" => [
                            [
                                "width" => 750,
                                "height" => 200,
                                "image" => "",
                                "link" => "",
                                "id" => "0856fdf8-d5a5-4e2c-aad9-6d4a8af8a7fb"
                            ]
                        ],
                        "module" => "search"
                    ],
                    [
                        "type" => "keyword",
                        "config" => [
                            "outer" => [
                                "width" => 750,
                                "height" => 60,
                                "background" => null
                            ],
                            "container" => [
                                "width" => 750,
                                "height" => 0,
                                "background" => null
                            ]
                        ],
                        "data" => [
                            [
                                "text" => "连衣裙、电脑、跑步鞋、",
                                "id" => "846c4f78-2631-4251-9e84-7b77f538172d"
                            ]
                        ],
                        "module" => "keyword"
                    ],
                    [
                        "type" => "blank",
                        "config" => [
                            "outer" => [
                                "width" => 750,
                                "height" => 10,
                                "background" => ""
                            ]
                        ],
                        "data" => [
                            [
                                "id" => "70633d55-4682-4794-8340-ad2ac6c3d225"
                            ]
                        ],
                        "module" => "blank"
                    ],
                    [
                        "type" => "carousel",
                        "config" => [
                            "outer" => [
                                "width" => 750,
                                "height" => 300,
                                "background" => "",
                                "paddingTop" => 0,
                                "paddingBottom" => 0
                            ],
                            "container" => [
                                "width" => 690,
                                "height" => 300,
                                "borderRadius" => 10
                            ],
                            "menu" => [
                                "fontColor" => "#000",
                                "lineCount" => 5,
                                "size" => 80,
                                "background" => 80,
                                "fontSize" => 12
                            ]
                        ],
                        "data" => [
                            [
                                "image" => "https://m.360buyimg.com/mobilecms/s700x280_jfs/t1/115456/40/7331/100669/5ec3a9c6E3dcbadb7/46071c04455c0d5b.jpg!q70.jpg.dpg",
                                "link" => "",
                                "id" => "0b4027dc-1eaa-48c9-a978-c0086f6e9d24"
                            ],
                            [
                                "image" => "https://m.360buyimg.com/mobilecms/s700x280_jfs/t1/115456/40/7331/100669/5ec3a9c6E3dcbadb7/46071c04455c0d5b.jpg!q70.jpg.dpg",
                                "link" => "",
                                "id" => "a16ee2d4-165f-4c34-b719-aed6a9042075"
                            ],
                            [
                                "image" => "https://m.360buyimg.com/mobilecms/s700x280_jfs/t1/115456/40/7331/100669/5ec3a9c6E3dcbadb7/46071c04455c0d5b.jpg!q70.jpg.dpg",
                                "link" => "",
                                "id" => "cf22ce92-234b-4c53-9be8-5acb2dad1079"
                            ]
                        ],
                        "module" => "carousel"
                    ],
                    [
                        "type" => "blank",
                        "config" => [
                            "outer" => [
                                "width" => 750,
                                "height" => 40,
                                "background" => null
                            ]
                        ],
                        "data" => [
                            [
                                "id" => "df6fb8e6-3f22-4220-b87a-76b1a3c4aae9"
                            ]
                        ],
                        "module" => "blank"
                    ],
                    [
                        "type" => "menu",
                        "config" => [
                            "outer" => [
                                "width" => 750,
                                "height" => 340,
                                "background" => null,
                                "paddingTop" => 0,
                                "paddingBottom" => 0
                            ],
                            "container" => [
                                "width" => 750,
                                "height" => 300,
                                "background" => "",
                                "radius" => 0,
                                "paddingTop" => 0,
                                "paddingBottom" => 0
                            ],
                            "title" => [
                                "label" => "",
                                "height" => 100
                            ],
                            "menu" => [
                                "rowNumber" => 5,
                                "rows" => 2,
                                "marginBottom" => 20,
                                "paging" => 1,
                                "width" => 150
                            ],
                            "icon" => [
                                "size" => 80,
                                "background" => null,
                                "marginBottom" => 0
                            ],
                            "font" => [
                                "fontSize" => 24,
                                "fontColor" => "#333",
                                "marginTop" => 10
                            ],
                            "indicator" => [
                                "show" => 1,
                                "activeBackground" => "#E42626"
                            ]
                        ],
                        "data" => [
                            [
                                "label" => "自营超市",
                                "link" => "",
                                "id" => "d6ca229f-5908-4f26-ab8c-de7f39e6486d",
                                "icon" => "https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/125678/35/5947/4868/5efbf28cEbf04a25a/e2bcc411170524f0.png.webp"
                            ],
                            [
                                "label" => "数码电器",
                                "link" => "",
                                "id" => "74c108f6-edb5-434f-8f48-ea9a27215733",
                                "icon" => "https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/135931/4/3281/5598/5efbf2c0Edbdc82c7/ed9861b4ddfb9f30.png.webp"
                            ],
                            [
                                "label" => "服饰美妆",
                                "link" => "",
                                "id" => "2707c37a-940c-4f9e-902c-dae92df9e781",
                                "icon" => "https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/115657/2/3439/7294/5ea7d41eE6b3d7c32/ed643edf6fe17d8d.png.webp"
                            ],
                            [
                                "label" => "自营生鲜",
                                "link" => "",
                                "id" => "9556fa64-e975-4a1d-a71d-a962d806165b",
                                "icon" => "https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/129215/21/5978/3618/5efbf344Ebec23ae8/59712d986b10bb0a.png.webp"
                            ],
                            [
                                "label" => "自营到家",
                                "link" => "",
                                "id" => "e9fc6655-c8ff-4153-9deb-3a954c11bfa6",
                                "icon" => "https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/116602/7/11200/3796/5efbf375Ebba41029/f07cc166f368fa05.png.webp"
                            ],
                            [
                                "label" => "话费充值",
                                "link" => "",
                                "id" => "17a7ba39-b198-41da-b765-c1ec426cf4e3",
                                "icon" => "https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/146390/3/1846/4909/5efbf39aEe5f5f797/300071558a9ab078.png.webp"
                            ],
                            [
                                "label" => "9.9元拼",
                                "link" => "",
                                "id" => "d6936213-a4c9-4b63-812d-b4c83647b132",
                                "icon" => "https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/150351/19/14167/6853/5fed882dE195ef673/b2aa7d67e675baf8.png.webp"
                            ],
                            [
                                "label" => "领券",
                                "link" => "/pages/coupon/center",
                                "id" => "852fa8ff-3e9f-40bc-9ad8-e08ef5c2f187",
                                "icon" => "https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/113589/24/11332/4897/5efbf3feE705d87db/e5c12d5e943266b9.png.webp",
                                "value" => "/pages/coupon/center"
                            ],
                            [
                                "label" => "借钱",
                                "link" => "",
                                "id" => "a409a274-64a8-4bcb-a3c4-eb27b2d885fd",
                                "icon" => "https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/129184/28/5977/3711/5efbf53aE2c2e6a07/7db529ce0e00838f.png.webp"
                            ],
                            [
                                "label" => "PLUS会员",
                                "link" => "",
                                "id" => "1a2e28bc-7bda-4d74-82d1-5516e7602e64",
                                "icon" => "https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/123730/37/5924/4189/5efbf567E0a226121/d04df7c74c87cf68.png.webp",
                                "value" => "asdasdasdasd"
                            ],
                            [
                                "label" => "自营国际",
                                "link" => "",
                                "id" => "a6cee599-a28e-4c7f-8746-372ff3e16c10",
                                "icon" => "https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/142596/7/1864/4759/5efbf5a9E60c62b8a/49cdd24cb2bfecf5.png.webp"
                            ],
                            [
                                "label" => "自营拍卖",
                                "link" => "",
                                "id" => "30bde0f6-8bce-4388-8b50-13ff3ab0255a",
                                "icon" => "https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/125193/15/5993/3443/5efbf5dbEa3327124/a4282d5cb2879c8b.png.webp"
                            ]
                        ],
                        "module" => "menu"
                    ],
                    [
                        "type" => "image-group",
                        "config" => [
                            "outer" => [
                                "width" => 750,
                                // "height" => 200,
                                "height" => 20,
                                "background" => "",
                                "alignItems" => "",
                                "justifyContent" => "",
                                "top-margin" => 0,
                                "bottom-margin" => 0,
                                "right-margin" => 0,
                                "left-margin" => 0
                            ]
                        ],
                        "data" => [
                            [
                                "name" => "主页可能你还喜欢上横幅",
                                "width" => 750,
                                "height" => 200,
                                // "image" => "https://m.360buyimg.com/mobilecms/s750x200_jfs/t1/164918/26/2539/79398/5fffa568E2c56bf21/0d7d799b1df959e2.png.webp",
                                "image" => "",
                                "link" => "",
                                "id" => "2dc79fbb-d5c3-4d90-8c67-e14e8947bcf4"
                            ]
                        ],
                        "module" => "image-group"
                    ],
                    [
                        "type" => "image-group",
                        "config" => [
                            "outer" => [
                                "width" => 750,
                                "height" => 100,
                                "background" => null,
                                "alignItems" => "center",
                                "justifyContent" => "center",
                                "top-margin" => 0,
                                "bottom-margin" => 0,
                                "right-margin" => 0,
                                "left-margin" => 0
                            ]
                        ],
                        "data" => [
                            [
                                "name" => "主页可能你还喜欢",
                                "width" => 355,
                                "height" => 40,
                                "image" => "https://img.alicdn.com/tfs/TB1V2eQrKSSBuNjy0FlXXbBpVXa-966-114.png",
                                "link" => "",
                                "id" => "963ee01b-abee-4469-b832-fd247c830c54"
                            ]
                        ],
                        "module" => "image-group"
                    ]
                ]
            ]
        ];
        return json($apidb);
    }

}
